# Maintainer: Balló György <ballogyor+arch at gmail dot com>

pkgname=sugar-toolkit-gtk3
pkgver=0.119
pkgrel=2
pkgdesc="Sugar GTK library"
arch=('loong64' 'x86_64')
url="https://sugarlabs.org/"
license=('LGPL')
depends=('alsa-lib' 'gtk3' 'libsm' 'python-cairo' 'python-dateutil' 'python-decorator'
         'python-six' 'sugar-artwork' 'sugar-datastore' 'telepathy-mission-control' 'unzip')
makedepends=('intltool' 'gobject-introspection')
optdepends=('webkit2gtk: run sugar-activity-web')
source=(https://download.sugarlabs.org/sources/sucrose/glucose/$pkgname/$pkgname-$pkgver.tar.xz)
sha256sums=('c64a2a03bbd1a6b626006a650584645920b5ef376724d4fc68bc5719a94bea73')

build() {
  cd $pkgname-$pkgver
  # Disable hardened build until fixed upstream
  # https://bugs.sugarlabs.org/ticket/4886
  export CFLAGS=${CFLAGS/ -fno-plt}
  export LDFLAGS=${LDFLAGS/,-z,now}

  ./configure --prefix=/usr
  sed -i 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make -j1
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
  rm "$pkgdir/usr/bin/sugar-activity"
}
